package com.vichat.common.constant;

import org.apache.commons.lang3.StringUtils;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

public class GlobalConstant {

    public static boolean IS_WV_CLOUD = true;
    public static String SYSTEM_PARAM = "SYSTEM_PARAM";
    public static String PLATFORM_NAME = "微恰对讲";
    public static String PLATFORM_PATH = "";
    public static boolean IS_SUPPORT_ROLE = false;
    public static  boolean IS_SUPPORT_CAPTCHA = true;
    public static final String DES_TOKEN = "kQ3l&9!v";


    public static final String SESSION_KEY_CAPTCHA = "captcha";
    public static final String SESSION_USER_KEY = "SEESION_USER";

    public static String getTitle(HttpServletRequest request) {
        String platformName = PLATFORM_NAME;
        Object obj = request.getSession(true).getAttribute("PLATFORM_NAME");
        if (obj != null && StringUtils.isNotEmpty((String) obj)) {
            platformName = (String) request.getSession(true).getAttribute("PLATFORM_NAME");
        }
        return platformName;
    }

    public static final long USER_USER_TYPE_OWNER_1 = 1L;//允许登陆后台
    public static final long USER_USER_TYPE_OWNER_0 = 0L;//禁止登陆后台

    public static final long RES_FILE_OBJ_TYPE_1 = 1L;//执法取证、谈话录音
    public static final long EVT_TYPE_EVIDENCE = 1L;


    //用户类型:1 企业 2 管理员 3 普通用户 4调度用户
    public static final long USER_TYPE_1 = 1L;
    public static final long USER_TYPE_2 = 2L;
    public static final long USER_TYPE_3 = 3L;
    public static final long USER_TYPE_4 = 4L;

    public static final long ENABLE = 1; // 启用
    public static final long DISABLE = 0; // 禁用


    public static final Integer DEFAULT = 0; // 默认
    public static final Integer NOT_DEFAULT = 1; // 非默认

    public static final String DEFAULT_PASSWORD = "111111";

    /**
     * 消息类型
     */
    public static final String MSG_TYPE_IMAGE = "image";//图片
    public static final String MSG_TYPE_AUDIO = "audio";//短语音
    public static final String MSG_TYPE_VIDEO = "video";//短视频
    public static final String MSG_TYPE_TEXT = "text";//普通文本消息
    public static final String MSG_TYPE_CALL = "call";//临时组呼叫消息
    public static final String MSG_TYPE_CALL_VIDEO = "callvideo";//视频监控消息
    public static final String MSG_TYPE_CALL_SOS = "callsos";//SOS告警消息
    public static final String MSG_TYPE_BROAD = "broad";//发送可靠通知
    public static final String MSG_TYPE_EVENT = "event";//普通事件提醒，就是提醒给谁看
    public static final String MSG_TYPE_PUSH_NOTIFI = "pushnotifi";//消息推送
    public static final String MSG_TYPE_DELCHANNEL = "calldelchannel";
    public static final String MSG_TYPE_ADDCHANNEL = "calladdchannel";
    public static final String MSG_TYPE_IMS_PUSH = "imspush";
    public static final String MSG_TYPE_WARNIN = "warnin";//进围栏
    public static final String MSG_TYPE_WARNOUT = "warnout";//出围栏


    public static final String MSG_TYPE_SHARE_VIDEO = "30";

    /**
     * 用户在线状态
     */
    public static final Long DISPLAY_STATE_0 = 0L;//离线
    public static final Long DISPLAY_STATE_1 = 1L;//在线

    /**
     * 频道类型 1 语音对讲 2 位置对讲 3 视频对讲 4 视频会议 5 视频监控
     */
    public static final Long ROOM_STYLE_1 = 1L;
    public static final Long ROOM_STYLE_2 = 2L;
    public static final Long ROOM_STYLE_3 = 3L;
    public static final Long ROOM_STYLE_4 = 4L;
    public static final Long ROOM_STYLE_5 = 5L;

    /**
     * 频道用户类型 0 外部成员 2 成员 4 管理 10 室主
     */
    public static final Long ROOM_RIGHT_0 = 0L;
    public static final Long ROOM_RIGHT_2 = 2L;
    public static final Long ROOM_RIGHT_4 = 4L;
    public static final Long ROOM_RIGHT_10 = 10L;



    public static final Integer DISPLAY_STATE_OFFLINE = 0;//0	离线：用户因断线或隐身或隐藏而处于不可见状态
    public static final Integer DISPLAY_STATE_ONLINE = 1;// 1	在线：用户当前可在线交流





    /**
     * ims_event_queue
     */
    public static final String IMS_EVENT_QUEUE = "ims_event_queue";//IM通知消息
    /**
     * gms_event_queue
     */
    public static final String GMS_EVENT_QUEUE = "gms_event_queue";//房间通知消息

    public static final String REFRESH_TYPE_USER = "user";//刷新联系人
    public static final String REFRESH_TYPE_ORG = "org";//刷新组织

    //ims 刷新底层消息类型
    public static final String IMS_MSG_TYPE_10008 = "10008";//刷新联系人
    public static final String IMS_MSG_TYPE_10009 = "10009";//刷新频道
    public static final String IMS_MSG_TYPE_10010 = "10010";//组织刷新
    public static final String IMS_MSG_TYPE_10011 = "10011";//强制退出
    public static final String IMS_MSG_TYPE_10012 = "10012";//守候频道

    //gms 刷新底层消息类型
    public static final String GMS_MSG_TYPE_10009 = "10009";//刷新频道


    //ims消息类型
    public static final String IMS_MSG_TYPE_1000 = "1000";//系统消息


    //gms消息类型
    public static final String GMS_MSG_TYPE_2000 = "2000";//系统广播
    //gms消息类型
    public static final String GMS_MSG_TYPE_4000 = "4000";//定位消息

    //ims告警
    public static final String IMS_ALARM = "5200";//告警消息
    public static final String IMS_ALARM_CLOSE = "5201";//告警关闭消息
    public static final String IMS_ALARM_OPEN = "5206";//告警开启消息
    public static final String IMS_ALARM_FENCE = "5210";//围栏告警

    //ims用户停用
    public static final String IMS_REMOVE_STOP = "5300";//用户停用消息
    public static final String IMS_REMOVE_START = "5301";//用户开启消息

    //App升级
    public static final String IMS_APP_UPGRADE = "6100";//App升级



    //通话类型
    public static final Long PHONE_MODEL_1 = 1L; // 1:可接可呼
    public static final Long PHONE_MODEL_2 = 2L; // 2:仅可接
    public static final Long PHONE_MODEL_3 = 3L; // 3:仅可呼

    //白名单导入编号
    public static final Long CAN_PHONE = 5L; // 白名单
    //亲情号码导入编号
    public static final Long FAMILY_PHONE = 6L; // 白名单
    //用户管理导入编号
    public static final Long CLOUD_USER = 7L; // 白名单


    public static final Long SEC_FUN_LEVEL_1 = 1l;//一级菜单
    public static final Long SEC_FUN_LEVEL_2 = 2l;//二级菜单
    public static final Long SEC_FUN_LEVEL_3 = 3l;//三级菜单(按钮级别)


    public static final long FREE_TYPE_0 = 0L;//收费，按个数收费
    public static final long FREE_TYPE_1 = 1L;//收费，按用户失效期收费

    public static final long FENCE_USER_TYPE_PARTY = 1L;//企业
    public static final long FENCE_USER_TYPE_ORG = 2L;//组织
    public static final long FENCE_USER_TYPE_USER = 3L;//用户
    public static final long FENCE_USER_TYPE_SENDUSER = 4L;//发送用户

    public static final long FENCE_DATE_TYPE_WEEK = 1L;//星期
    public static final long FENCE_DATE_TYPE_MONTH = 2L;//月份
    public static final long FENCE_DATE_TYPE_DAY = 3L;//每天

    public static long MAX_TERMINAL_AUTH_NUMBER = 10000L;
    public static long MAX_DISPATCHER_AUTH_NUMBER = 10000L;
    public static boolean CHECK_DISPATCHER_SN = true;
    public static boolean CHECK_TERMINAL_SN = true;

    public static boolean SUPPORT_ADMIN_LOGIN_APP = false;

    public static final long SYS_MSG_ALARM = 1L;
    public static final long SYS_MSG_SHOW_TYPE_PC = 1L;
    public static final long SYS_MSG_SHOW_TYPE_APP = 2L;

    public static final long OBJ_TYPE_ALARM_IN = 1L;//Alarm_in
    public static final long OBJ_TYPE_ALARM_OUT = 2L;//Alarm_out

    public static String GPS_TYPE = "";

    public static Locale SYS_LANGUAGE = Locale.CHINA;

    public static List<String> USABLE_FILE_SUFFIX_LIST = new ArrayList<>();
}
